<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>供存销系统</title>
    <meta name="csrf_token" id="token" content="{{ csrf_token() }}">
    <!-- Fonts -->
    @section('script')
        <script src="{{env('CDN_DOMAIN_NAME')}}/js/app.js"></script>
    @show
    @section('style')
        {{--<link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700" rel='stylesheet' type='text/css'>--}}
        <link href="{{env('CDN_DOMAIN_NAME')}}/css/app.css" rel="stylesheet">
        <link rel="shortcut icon" href="{{env('CDN_DOMAIN_NAME')}}/img/favicon.ico">
        <link href="{{env('CDN_DOMAIN_NAME')}}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
        <link href="{{env('CDN_DOMAIN_NAME')}}/css/font-awesome.min.css" rel="stylesheet">
        <link href="{{env('CDN_DOMAIN_NAME')}}/css/style.css?v=4.1.0" rel="stylesheet">
        <link href="{{env('CDN_DOMAIN_NAME')}}/css/cost_entry.css?v=2.0.0" rel="stylesheet"><!--出库、财务的公用样式表-->
        <link href="{{env('CDN_DOMAIN_NAME')}}/css/commoncss/caution.css" rel="stylesheet">
        <link href="{{env('CDN_DOMAIN_NAME')}}/css/commoncss/radio.css?v=1.0.2" rel="stylesheet">

        <link rel="stylesheet" href="https://at.alicdn.com/t/font_836680_usm13j7t3dr.css">
        <link rel="stylesheet" href="{{env('CDN_DOMAIN_NAME')}}/store/commoncss/element-2.4.1.css">
        <script src="{{env('CDN_DOMAIN_NAME')}}/store/commonjs/vue.js?v0.0.3"></script>
        <script src="{{env('CDN_DOMAIN_NAME')}}/store/commonjs/element-2.4.1.js"></script>
    @show
    <style>
        body {
            font-family: 'Lato';
        }
        .fa-span{width: 20px;height: 16px;display: inline-block;}
        #tipsInfo{position:absolute;top:9px;right:7px;background:red;color:#fff;width:20px;height:20px;line-height:20px;text-align:center;padding:0;}
        #infosW{text-align:center;}
    </style>
</head>
<body class="fixed-sidebar full-height-layout gray-bg" >
<div  style="background-color: #fff;">
    <!--左侧导航开始-->
    <div id="wrapper">
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="sidebar-collapse">
                @if(Auth::check()&&!Auth::guard('admin')->check())
                    @if(Auth::user()->is_bus == 0)
                        <ul class="nav" id="side-menu">
                            <li class="item-li">
                                <a class="J_menuItem" href="#">
                                    <span class="fa-span"><i class="fa fa-home"></i></span>
                                    <span class="nav-label">确认收货</span>
                                </a>
                            </li>
                        </ul>
                    @elseif(Auth::user()->is_bus == 3)
                        <ul class="nav" id="side-menu">
                            <li class="item-li">
                                <a class="J_menuItem" href="#">
                                    <span class="fa-span"><i class="fa fa-home"></i></span>
                                    <span class="nav-label">质检</span>
                                </a>
                            </li>
                        </ul>
                    @endif
                @else
                    <ul class="nav" id="side-menu">
                        <li class="nav-header item-li">
                            <div class="dropdown profile-element">
                                <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                            <span class="clear" style="display: inherit;">
                                <span class="block m-t-xs" style="font-size:20px;">
                                    <i class="fa fa-desktop"></i>
                                    <strong class="font-bold">蓝鲸系统</strong>
                                </span>
                            </span>
                                </a>
                            </div>
                            <div class="logo-element">大品</div>
                        </li>
                        <li class="item-li">
                            <a class="J_menuItem" href="/backstage/home">
                                <span class="fa-span"><i class="fa fa-home fa-lg"></i></span>
                                <span class="nav-label">主页</span>
                            </a>
                        </li>

                        @if($menus = Auth::guard('admin')->user()->role_menu())
                            @foreach($menus[0] as $menu)
                                <li class="item-li">
                                    <a class="J_menuItem" href="#">
                                        <span class="fa-span"><i class="fa {{$menu['icon']}}"></i></span>
                                        <span class="nav-label">{{$menu['name']}}</span>
                                        <span class="fa arrow"></span>
                                    </a>
                                    @if(isset($menus[$menu['id']]))
                                        @foreach($menus[$menu['id']] as $subMenu)
                                            <ul class="nav nav-second-level">
                                                <li><a class="J_menuItem" href="{{$subMenu['route']}}">{{$subMenu['name']}}</a></li>
                                            </ul>
                                        @endforeach
                                    @endif
                                </li>
                            @endforeach
                        @endif
                    </ul>
                @endif
            </div>
        </nav>
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-info " href="#" style="height:30px;"><i style="margin-top:4px;" class="fa fa-bars"></i> </a></div>
                    <div>
                        <ul class="nav navbar-top-links navbar-right">
                            <!-- Authentication Links -->
                            @if (Auth::guard('admin')->check())
                                <li class="pull-right" style="margin-right: 100px"><a href="{{ url('/adminLoginOut') }}">退出</a></li>
                                <li class="pull-right dropdown" style="margin-right: 50px">
                                    <ul class="dropdown-menu dropdown-alerts">
                                        <li>
                                            <a href="#">
                                                <div>
                                                    <i class="fa fa-envelope fa-fw"></i> ✘✘✘生成了二维码
                                                    <span class="pull-right text-muted small">4分钟前</span>
                                                </div>
                                            </a>
                                        </li>
                                    </ul>
                                </li>
                                @if(in_array(Auth::guard('admin')->user()->identity_type,[1,2]))
                                    @if ($msg_data = Auth::guard('admin')->user()->get_no_read_msg())@endif
                                    <li class="dropdown pull-right">
                                        <a href="#" class="dropdown-toggle icon-menu" data-toggle="dropdown">
                                            <i class="fa fa-bell-o fa-lg"></i>
                                            <?php $msg_count=count($msg_data['content']);?>
                                            @if($msg_data['count']>0)
                                                <span class="badge bg-danger" id="tipsInfo"><?php echo $msg_data['count'];?></span>
                                            @endif
                                        </a>
                                        <ul class="dropdown-menu dropdown-messages">
                                            @if($msg_count>0)
                                                <?php $j=1;?>
                                                @foreach ($msg_data['content'] as $k => $v)
                                                    <li class="m-t-xs">
                                                        <div class="dropdown-messages-box" id="infosW">
                                                            <a href="/work-order/work-order-chat?id={{$v['pid']}}&tn=1" id="infosW">{{$v['content']}}...</a>
                                                        </div>
                                                    </li>
                                                    <?php $j++;?>

                                                    @if($k+1<$msg_count)
                                                        <li class="divider"></li>
                                                    @endif

                                                    <?php if($j>3)break;?>
                                                @endforeach

                                                @if($msg_count>3)
                                                    <li class="m-t-xs">
                                                        <div class="dropdown-messages-box" id="infosW">
                                                            <a href="/work-order/msg-lists?tn=1" class="more">更多</a>
                                                        </div>
                                                    </li>
                                                @endif

                                            @else
                                                <li class="m-t-xs">
                                                    <div class="dropdown-messages-box" id="infosW">
                                                        <a href="javasvript:; 'pid']}}&tn=1" id="infosW" style="color:#676a6c;cursor:default;">没有新消息</a >
                                                    </div>
                                                </li>
                                            @endif

                                        </ul>
                                    </li>
                                @endif

                                @if(in_array( Auth::guard('admin')->user()->department_id(),[4,3]))
                                    <li class="dropdown pull-right">
                                        <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#" style="padding: 15px 0 15px 10px;">
                                            <span class="nav-label" style="display:inline-block;">工单</span>
                                            <span style="float:right;margin-left:10px;">|</span>
                                            <span class="fa fa-sort-desc" style="float:right;margin-left:5px;"></span>
                                        </a>
                                        <ul class="dropdown-menu dropdown-messages" style="width:150px;">
                                            <li class="m-t-xs">
                                                <div class="dropdown-messages-box">
                                                    <div class="media-body " style="text-align: center">
                                                        <a href="/work-order/work-order-lists?tn=1">工单列表</a>
                                                    </div>
                                                </div>
                                            </li>
                                            <li class="divider"></li>
                                            <li class="m-t-xs">
                                                <div class="dropdown-messages-box">
                                                    <div class="media-body " style="text-align: center">
                                                        <a href="/work-order/msg-lists?tn=1">消息列表</a>
                                                    </div>
                                                </div>
                                            </li>
                                            @if(Auth::guard('admin')->user()->department_id()==3)
                                                <li class="divider"></li>
                                                <li class="m-t-xs">
                                                    <div class="dropdown-messages-box">
                                                        <div class="media-body " style="text-align: center">
                                                            <a href="/work-order/submit-work-order?tn=1">提交表单</a>
                                                        </div>
                                                    </div>
                                                </li>
                                            @endif

                                        </ul>
                                    </li>
                                @endif
                                <li class="dropdown pull-right" style="margin-right:0;">
                                    {{--<a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">{{ Auth::guard('admin')->user()->admin_name }}</a>--}}
                                    <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#" style="padding: 15px 0 15px 10px;">
                                        <span class="nav-label global_userName" style="display:inline-block;">{{ Auth::guard('admin')->user()->admin_name }}</span>
                                        <span style="float:right;margin-left:10px;">|</span>
                                        <span class="fa fa-sort-desc" style="float:right;margin-left:5px;"></span>
                                    </a>
                                    <ul class="dropdown-menu dropdown-messages">
                                        {{--<li class="m-t-xs">--}}
                                        {{--<div class="dropdown-messages-box">--}}
                                        {{--<div class="media-body " style="text-align: center">--}}
                                        {{--<a href="/backstage/boundQr?id={{ Auth::guard('admin')->user()->id }}">请点击绑定微信</a>--}}
                                        {{--</div>--}}
                                        {{--</div>--}}
                                        {{--</li>--}}
                                        {{--<li class="divider"></li>--}}
                                        <li class="m-t-xs">
                                            <div class="dropdown-messages-box">
                                                <div class="media-body ">
                                                    <small>用户名：{{ Auth::guard('admin')->user()->admin_name }}</small>
                                                </div>
                                            </div>
                                        </li>
                                        <li class="divider"></li>
                                        <li>
                                            <div class="dropdown-messages-box">
                                                <div class="media-body ">
                                                    <small>手机号：{{ Auth::guard('admin')->user()->admin_tel }}</small>
                                                </div>
                                            </div>
                                        </li>
                                        <li class="divider"></li>
                                        <li class="m-t-xs">
                                            <div class="dropdown-messages-box">
                                                <div class="media-body ">
                                                    <small>所属公司：{{ $data = Auth::guard('admin')->user()->show_company_name() }}</small>
                                                </div>
                                            </div>
                                        </li>
                                        <li class="divider"></li>
                                        <li>
                                            <div class="dropdown-messages-box">
                                                <div class="media-body ">
                                                    <small>登录时间：{{ Auth::guard('admin')->user()->updated_at }}</small>
                                                </div>
                                            </div>
                                        </li>

                                    </ul>
                                </li>
                            @elseif(Auth::check())
                                <li class="pull-right" style="margin-right: 100px"><a href="{{ url('/userLoginOut') }}">退出</a></li>
                            @endif
                        </ul>
                    </div>
                </nav>
            </div>
            <div>
            @include('flashy::message')
            @yield('content')
            <!--右侧部分结束-->
            </div>
        </div>
    </div>
    <!--左侧导航结束-->
</div>
<!--右侧部分开始-->
@include('public/caution')
<!-- 全局js -->
<script src="{{env('CDN_DOMAIN_NAME')}}/js/bootstrap.min.js"></script>
<script src="{{env('CDN_DOMAIN_NAME')}}/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="{{env('CDN_DOMAIN_NAME')}}/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- 自定义js -->
<script src="{{env('CDN_DOMAIN_NAME')}}/js/default.js"></script>
<script src="{{env('CDN_DOMAIN_NAME')}}/js/hAdmin.js?v=4.1.0"></script>
<!--全局修改url参数函数-->
<script>
    //url参数获取
    (function ($) {
        $.getUrlParam = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }
    })(jQuery);
    //修改url参数封装
    function replaceParamVal(paramName,replaceWith) {
        var oUrl = this.location.href.toString();
        var re=eval('/('+ paramName+'=)([^&]*)/gi');
        var nUrl = oUrl.replace(re,paramName+'='+replaceWith);
        this.location = nUrl;
    }
    //跳转判断
    function returnPage() {
        var count=$(".info_sum").text();
        var maxBage=Math.ceil( Number(count)/10 );
        var getPageNum = $('.returnPage').val();
        if(getPageNum == ""){
            $(".faceImg").attr("src","/img/weep.png");
            $(".oHandle").text('请输入页码！');
            $(".oSuccess").show(0).delay(1000).hide(0);
        }else if(getPageNum == "0"){
            $(".faceImg").attr("src","/img/weep.png");
            $(".oHandle").text('请输入正确的页码！');
            $(".oSuccess").show(0).delay(1000).hide(0);
        }else if(getPageNum>maxBage){
            $(".faceImg").attr("src","/img/weep.png");
            $(".oHandle").text('请输入正确的页码！');
            $(".oSuccess").show(0).delay(1000).hide(0);
        }else if(!/^[0-9]*$/.test(getPageNum)){
            $(".faceImg").attr("src","/img/weep.png");
            $(".oHandle").text('请输入数字！');
            $(".oSuccess").show(0).delay(1000).hide(0);
        } else {
            if ($.getUrlParam('page') == null) {
                if(window.location.href.indexOf('&') > 0){
                    window.location.href = window.location.href + "&page=" + parseInt(getPageNum);
                }else{
                    window.location.href = window.location.href + "?page=" + parseInt(getPageNum);
                }
            }else{
                replaceParamVal('page', parseInt(getPageNum));
            }
        }
    }
</script>
</body>
</html>